﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;

namespace TSNPro.Base
{
    public class BaseItem
    {
        private string _name;
        protected JObject _obj;
        protected JObject _other;

        // 构造函数
        public BaseItem()
        {
        }

        // 属性：Name
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public string FriendlyName
        {
            get
            {
                return _obj["FriendlyNmae"].ToString();
            }
        }

        // 设置配置
        public virtual void SetConfig(JObject obj)
        {
            _obj = obj;
        }

        // 设置其他配置
        public virtual void SetOtherConfig(JObject other)
        {
            _other = other;
        }

        // 初始化方法
        public virtual bool Init()
        {
            return true;
        }

        // 获取配置界面
        public virtual Control GetConfigWidget()
        {
            throw new NotImplementedException($"{_name} 未实现配置界面");
        }
    }
}
